package com.itrip.trade.config;

import java.io.FileWriter;
import java.io.IOException;

/* *
 *类名：AlipayConfig
 *功能：基础配置类
 *详细：设置帐户有关信息及返回路径
 *修改日期：2017-04-05
 *说明：
 *以下代码只是为了方便商户测试而提供的样例代码，商户可以根据自己网站的需要，按照技术文档编写,并非一定要使用该代码。
 *该代码仅供学习和研究支付宝接口使用，只是提供一个参考。
 */

public class AlipayConfig {

//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016092900621013";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQCDOI+W+tvHd5nUQ4eCrWWOTeMFs5qBQeWRU4TnxXlZ7Te1kf/k/eqnR0MknnOM+w2Dncq7K4Hfcsyl9banxxByCjGNK72saxi0g+v8tAgZ4l82YgimOkqisjcBZ2k5tl+4KkyrK1TboJWg0//mcaJWG1KAtReC/+3IqrBTh4Dbxb7b7lFpJMMpBwiWCPQlcyphgpUeOMeTNrns+QeVgt3z9oL/v2EPjwKLMIUMrJs4K1FddEQ+FIq71P6ppyuNsX50fgg3rcHHFjU4JoSpRp+5Ez9XsMc7iSl2wsBcJKdMf2CIoYKzWT9Nikfh+S2c0ibY04v5Aafg+Hn4QSvmx7EPAgMBAAECggEASoV9ro3K8S3wM8ciF0moSjfbfSpxzYSB/pWC/il88GAy6i//NqopcFSdQhemoeMV2rBrKP7dY+wLYxj3YbNAmLNHTtgPgPLVdfcRt1L64tBXqEfmh5jFOD6j1G1JKhhzpeCH6BHUwGIjd9HOG65fNi2QHj46GxCDlxmwx89FlAmTjjLr4+MpRldsw3gouibTM8yxkCkaVTBJZFHIJ5vAGv1nAoGyW6TsO2Zh+KzWt6WPxOlhqQ3+0Vqh5r1Rxlu2/1DRbwWF/MuToOv/YSrCjB2BZUUoAMD5YQIAa95u4CdZ5KpOAaUwwGr8dQypuMt90RWXmuLABMYCrDWcQMwjAQKBgQDsg8LWsogQtHhMN+eyu0Dm2+Fu39ru4Qy9GL+5sOBXNVr625w5jcKb1cQ4R+WLVuqjxqCuXmk2kKwPJltKLQ4gkV03DZz4j+5T5WB9vjUKM3X1fMVzUN7N7u+M7LCIoQnkj6h3cpDbbPrLbqPzfNfsrmFJmqZp7vHrT1js26xUjwKBgQCOCBcpF0jyaYwwrcz7fSRahLcktfXUsNpXQm6idwD3Umxxj4WcI3D2kjBKtjCx4QRRptvLSXAUriqAh8sRk0duIF9+NRWybP6YIP+fgNV07U2SzNJvBjg/RmdchtOlZyZe7P8bHVMCxDeaqMvgsPm4jIUWSGmY8ocLxdsLNpobgQKBgQCnf6Tjweok0nqDl/AKHx0Woc/kYrq9BDquTLGzQzWN7WZyVEcuZ1vUWy6soRZKeRKRTCENfCVNFGYWEJcEUCY6IFiAna52RhCF7+NHCgasI8e9RFDdmv8/nqCeEB3xlQLZkHfBqCw4idSPb9rCnL6aiuCxbMnAKg3AFSCoFebUtwKBgQCEoD9oSmr+mdqjthd8Gx4wPE98Q0F7y20HIGyI3tETIW9MF3XvGBUq2dWoXjpYT8Mlr8b8K+YyGXRssuDH15xS1H33LwDErQyL5/xq5/XrCpBubT5vGAK76zUnbGsDv69P4sRQgHB8W9eEXuyKMxfs4aKA7TtV69p4/teMv/7lgQKBgQDLFGMDrot1+zbiLrrKn/ve+4dMwCqJA8X9tM+BDtDPge4VGuFpawix5zwpblocjYyI/lhDXJbNY71h2QdcvJsJVW0fYLd/QUtKrLulxMjuHQrnLCFEqHKhZGXioQ7kUA3ctxmO8xOGEkqTWIIzmy+q8kmhw5wQNNsMubfqCTmm2Q==";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAii9Bp8mWrba2p5BMlnc1BbqIzsqWbDXOM/lwetckTtUhlC5uZrc4tpFkdRNXS1aZAkBgaYP3yVvVSfsqDlE8CUq3ADiyVzKmV0byTdVQ0IqC0QgBELovzgLUzMIOUYgtSLaes4r+1sM/CxS35FfIXAHmLSJhAXIWIYh1XD5SpqzzH6Mz9ZXJnSB0PU/5qKAJn1g3NsyEHZQwaF2B2If930UbZWTuXbRLNmAgmYvtNgVtmDONfE69FifN3rjiT806EWArzR7Y33pIpofsJ0SLcQM5MsU4Nwof/X5+9+yfhkRZ6mnZJ1H504QT5rAUPI2eMUk8PYADHZv0rCL9zaBI/wIDAQAB\n";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String notify_url = "http://itrip.test.com/trade/api/notify";

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://itrip.test.com/trade/api/returns";

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = "C:\\";


//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

